package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.system.domain.SysFileLog;
import com.ruoyi.system.service.ISysFileLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/system/fileLog")
public class SysFileLogController extends BaseController {
    @Autowired
    private ISysFileLogService sysFileLogService;
    @Autowired
    private ServerConfig serverConfig;
    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long templateId)
    {
        SysFileLog file = sysFileLogService.getById(templateId);
        String url = serverConfig.getUrl() + "/profile" + file.getFilePath();
        file.setFileUrl(url);
        return success(file);
    }

}
